<template>
  <div style="width: 100%; height: 100%; position: fixed">
    <el-container>
      <el-aside width="200px" class="heightAll">
        <el-menu default-active="/main" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
          background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" router>
          <el-menu-item index="/main">
            <i class="el-icon-menu"></i>
            <span>主页</span>
          </el-menu-item>
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>POS管理系统</span>
            </template>
            <el-menu-item index="/deviceManager" @click="changeTitle('终端管理')">
              <i class="el-icon-setting"></i>
              <span>终端管理</span>
            </el-menu-item>
<!--            <el-menu-item index="/deploy" @click="changeTitle('部署配置')">-->
<!--              <i class="el-icon-setting"></i>-->
<!--              <span>部署配置</span>-->
<!--            </el-menu-item>-->
<!--            <el-menu-item index="/globalConfig" @click="changeTitle('服务配置')">-->
<!--              <i class="el-icon-setting"></i>-->
<!--              <span>服务配置</span>-->
<!--            </el-menu-item>-->
<!--            <el-menu-item index="/refund" @click="changeTitle('交易退款')">-->
<!--              <i class="el-icon-setting"></i>-->
<!--              <span>交易退款</span>-->
<!--            </el-menu-item>-->
<!--            <el-menu-item index="/task" @click="changeTitle('任务配置')">-->
<!--              <i class="el-icon-setting"></i>-->
<!--              <span>任务配置</span>-->
<!--            </el-menu-item>-->
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <el-button @click="changePage('druid/index.html')">druid-Sql监控</el-button>
          <el-button @click="changePage('rs/logic/clear')">清除Logic缓存</el-button>
          <el-button @click="changePage('rs/sql/clear')">清除Sql缓存</el-button>
          <el-button @click="changePage('rs/init')">重新加载定时器</el-button>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>

export default {
  name: 'Index',
  data () {
    return {
      title: '主页'
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    changeTitle (title) {
      this.title = title
    },
    changePage (url) {
      window.open(url)
    }
  }
}

</script>

<style scoped>
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    height: 100%;
  }

  .heightAll {
    height: 100%;
  }

  .el-header,
  .el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
  }

  .el-aside {
    background-color: #333;
    color: #333;
    text-align: center;
    line-height: 200px;
  }

  body>.el-container {
    margin-bottom: 40px;
  }

  .el-container:nth-child(5) .el-aside,
  .el-container:nth-child(6) .el-aside {
    line-height: 260px;
  }

  .el-container:nth-child(7) .el-aside {
    line-height: 320px;
  }

</style>
